<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');


class Account extends CCMIS_Controller{

    public function __construct() {
        parent::__construct();
        $this->load->model('rmis/mdl_rmis','research');
        //dito iloload ung mga model na kakailanganin ng Account Controller. better have this constructor.
    }

    public function index()
    {
    	$this->myaccount();
    	$data = array(
           'page_title' => 'RMIS | Account'
        );
        $type = $this->research->getMemberType('1010000669');
            switch($type){
                case 1:
                    $this->setup_view('rmis/account/myaccount', $data);
                break;
                case 2:
                    $this->setup_view('rmis/account/allaccounts', $data);
                break;
            }
    }
	public function myaccount(){
		//1010000669
        $data = $this->populate(1);
        $data['page_title'] = "RMIS | Account";
        $this->setup_view('rmis/account/myaccount', $data);
	}
	public function addaccount(){
		$data = array(
           'page_title' => 'RMIS | Account'
        );
		$this->setup_view('rmis/account/addaccount', $data);
	}
	public function noaccount(){
		$data = array(
			'page_title' => 'RMIS | Account'
		);
		$this->setup_view('rmis/account/noaccount', $data);
	}

	public function editaccount(){
		$data = array(
			'page_title' => 'RMIS | Account'
		);
		$this->setup_view('rmis/account/editaccount', $data);
	}	

	private function populate($ID){
        
        $i = 0;
        $MemID = '1010000669';
        $resID = $this->research->getResearchIDs($MemID);
        $resTitle[] = null;
        foreach ($resID as $id) {
            $resTitle[$i] = $this->research->getResearchTitle($id['ID']);
        }

        $temp['resTitle'] = $resTitle;
        return $temp;
    }
}
?>